package socket;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClient;

public class MyVerticle4 extends AbstractVerticle {

	@Override
	public void start() throws Exception {
		WebClient webClient = WebClient.create(vertx);
		webClient.getAbs("http://localhost:8888/jetlinks/public/api/deviceProperty/HHHHH-24/SU")
				.timeout(5000)
				.send(
						handle -> {
							// 处理响应的结果
							if (handle.succeeded()) {
								// 这里拿到的结果就是一个HTML文本，直接打印出来
								System.out.println(handle.result().bodyAsString());
							} else {
								handle.cause().printStackTrace();
							}
						});
	}

	public static void main(String[] args) {
		Vertx vertx = Vertx.vertx();
		vertx.deployVerticle(new MyVerticle4());
	}
}
